/**
 * @用指针计算字符串的长度
 *
 * @author	 wangshikun <wangshikun2010@gmail.com>
 * @copyright	(c) 2012 wangshikun <wangshikun2010@gmail.com>
 * @license	http://www.opensource.org/licenses/mit-license.php The MIT License
 * @package	default
 * @subpackage	default
 */

#include <stdio.h>

int stringLength(const char *string);

int main(int argc, char *argv[]) {
	printf("The length of the string is: %d\n", stringLength("wang shi kun"));

	return 0;
}

int stringLength(const char *string) {
	const char *c = string;

	while (*c != '\0') {
		c++;
		printf("%d\n", *c);
	}

	printf("%d\n", *c);
	printf("%d\n", *string);
	return c - string;
}
